package org.douxiaoban.client.api;

import org.douxiaoban.client.activity.UserHomeActivity;
import org.douxiaoban.client.adapter.UsersAdapter;
import org.douxiaoban.client.app.Assistant;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;

public class UserList extends DoubanList {
//	private Context mContext;
	public UserList(Context context, UsersAdapter adapter, DoubanListType type){
		super(context, adapter, type);
	}
	
	/*
	 * to somebody's home 
	 */
	@Override
	public void clickEvent(AdapterView<?> arg0, View arg1, int index, long id) {
//		if(0 == index--){
//			return;
//		}
		UserInfoData data = (UserInfoData)((UsersAdapter)getAdapter()).getItem(index);
		String userId  = data.mId;
		Bundle bundel = new Bundle();
		bundel.putString(Assistant.KEY_USER_ID, userId);
		Intent intent = new Intent();
		intent.putExtras(bundel);
		intent.setFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
		intent.setClass(mContext, UserHomeActivity.class);
		mContext.startActivity(intent);
	}

	@Override
	public boolean longClickEvent(AdapterView<?> arg0, View arg1, int index,
			long id) {
		//  make it to short click
		return false;
	}
	

}